package org.springblade.modules.repair.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import org.springblade.core.tool.node.INode;
import org.springblade.modules.system.vo.DeptVO;

import java.util.ArrayList;
import java.util.List;

/**
 * @Date 9:41 2022/5/18
 * @Description {
 *   维修部件 tree
 * }
 * @Author lsay
 **/
@Data
public class MalfunctionPartsTreeVO implements INode<MalfunctionPartsTreeVO> {

	/**
	 * 主键ID
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	private Long id;

	/**
	 * 父节点ID
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	private Long parentId;

	/**
	 * 子孙节点
	 */
	@JsonInclude(JsonInclude.Include.NON_EMPTY)
	private List<MalfunctionPartsTreeVO> children;

	/**
	 * 是否有子孙节点
	 */
	@JsonInclude(JsonInclude.Include.NON_EMPTY)
	private Boolean hasChildren;

	@Override
	public List<MalfunctionPartsTreeVO> getChildren() {
		if (this.children == null) {
			this.children = new ArrayList<>();
		}
		return this.children;
	}

	private String name;

}
